﻿using System.Reflection;

namespace Borg
{
    internal class RegisterPluginTask : Task<PluginInfo>
    {
        private readonly bool _isManual;

        public override string Name
        {
            get { return string.Format("RegisterPlugin({0})", obj.Name); }
        }

        public RegisterPluginTask(PluginInfo obj, bool isManual, uint taskGroupId, Assembly initiator)
            : base(obj, taskGroupId, initiator)
        {
            _isManual = isManual;
        }

        public override void Execute()
        {
            obj.InternalRegister(_isManual, taskGroupId, initiator);
        }

        public override string ToString()
        {
            return string.Format("{0}: {1}.InternalRegister({2})", taskGroupId, obj, _isManual ? 1 : 0);
        }
    }
}

